Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
Typeerror: cannot set property "password" of null

having some trouble figuring out why I get this error. I have tried changing syntax but dont get it right, please help. I think this is just a syntaxerror.

this is how i send my data

const data = { newPassword : newPassword }

const response = await request({ endpoint: `blablabla`, method: "PUT", body: data }

this is how i receive the data

const {newPassword}  = req.body; 

if(token && newPassword) {
    console.log("token and password exist");
    User.findOne({token: token}).then(user=> {
        console.log("password" + newPassword); //prints out correct password
        user.password = newPassword;
        user.usertoken = "";
        user.save(function(err){
          if(err)return next(err);
          else res.json({message:"Password changed",result:true})
        });
      
    }).catch(next)
  }
  else {
    res.status(400).json({message:"Missing information! The password could not be updated.",result:false})
  }
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda